namespace ChartManager.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class initial : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.Charts",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        ReleaseTime = c.DateTime(nullable: false),
                        Custom1 = c.String(),
                        Custom2 = c.String(),
                        Custom3 = c.String(),
                    })
                .PrimaryKey(t => t.Id)
                .Index(t => t.ReleaseTime);
            
            CreateTable(
                "dbo.ChartRows",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Rank = c.Int(nullable: false),
                        LastWeek = c.Int(),
                        WeekOn = c.Int(nullable: false),
                        Peak = c.Int(nullable: false),
                        Chart_Id = c.Int(nullable: false),
                        Song_Id = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.Charts", t => t.Chart_Id, cascadeDelete: true)
                .ForeignKey("dbo.Songs", t => t.Song_Id, cascadeDelete: true)
                .Index(t => t.Chart_Id)
                .Index(t => t.Song_Id);
            
            CreateTable(
                "dbo.Songs",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        SingersAsString = c.String(),
                        Name = c.String(),
                    })
                .PrimaryKey(t => t.Id);
        }
        
        public override void Down()
        {
            DropForeignKey("dbo.ChartRows", "Song_Id", "dbo.Songs");
            DropForeignKey("dbo.ChartRows", "Chart_Id", "dbo.Charts");
            DropIndex("dbo.ChartRows", new[] { "Song_Id" });
            DropIndex("dbo.ChartRows", new[] { "Chart_Id" });
            DropIndex("dbo.Charts", new[] { "ReleaseTime" });
            DropTable("dbo.Songs");
            DropTable("dbo.ChartRows");
            DropTable("dbo.Charts");
        }
    }
}
